package com.codeplex.boomships.Client;

import java.util.*;
import com.codeplex.boomships.communication.Command;
import com.codeplex.boomships.communication.Msg;

public class ChatThread extends Thread {
	
	public List<Msg<String>> tasktail;
	
	private volatile boolean done = false;
	
	ConsoleWriter console;
	String playerName;
	Scanner scanner;
	
	public ChatThread(String playerName){
		this.playerName = playerName;
		this.console = new ConsoleWriter();
		this.scanner = new Scanner(System.in);
	}
	
	public void shutdown(){
		done = true;
	}
	
	@Override
	public void run(){
		while(!done){
			
			if(!tasktail.isEmpty()){
				
			}else{
				try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
	
	private Msg<String> kbListener(){
		Msg<String> msg = new Msg<String>();
		msg.setCommand(Command.MSG);
		msg.setSender(playerName);
		msg.setParam(scanner.nextLine().trim());
		return msg;
	}
	private void doTask(){
		
	}
	
	public void addTask(Msg<String> task){
		tasktail.add(task);
	}

}
